package com.ruoyi.controller.jpjs.grossprofit;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.service.jpjs.PublicService;
import com.ruoyi.service.jpjs.grossprofit.GrossProfitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author zeo
 * 毛利润报表
 */
@Controller
@RequestMapping("/grossProfit")
public class GrossProfitController extends BaseController {

    @Autowired
    GrossProfitService grossProfitService;

    @Autowired
    PublicService publicService;

    private String prefix = "jpjs/grossprofit";

    @GetMapping()
    public String grossProfit(ModelMap mmap) {
        mmap.put("userComp", publicService.findUserComp());
        return prefix + "/grossProfit";
    }

    /**
     * 获取计划毛利润
     * @param map
     * @return
     */
    @RequestMapping("/findPlanList")
    @ResponseBody
    public TableDataInfo findPlanList(@RequestParam Map map) {
        startPage();
        return getDataTable(grossProfitService.findPlanList(map));
    }

    /**
     * 获取实际毛利润
     * @param map
     * @return
     */
    @RequestMapping("/findActualList")
    @ResponseBody
    public TableDataInfo findActualList(@RequestParam Map map) {
        startPage();
        return getDataTable(grossProfitService.findActualList(map));
    }
}

